<template>
  <div>
    <div class="item" v-for="(item, index) of list" :key="index">
      <!-- 一级标题 -->
      <div class="item-title border-bottom">
        <span class="item-title-icon"></span>
        {{item.title}}
      </div>
      <!-- 递归组件  使用本身组件 数据传递进去 实现递归 name代表本组件 数据是传递的chirdren-->
      <div v-if="item.children" class="item-chilren">
        <detail-list :list="item.children"></detail-list>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "DetailList",
  props: {
    list: {
      type: Array,
      default() {
        return [];
      }
    }
  }
};
</script>

<style lang="stylus" scoped>
.item-title-icon {
  position: relative;
  left: 0.12rem;
  top: 0.12rem;
  display: inline-block;
  width: 0.72rem;
  height: 0.72rem;
  background: url('http://s.qunarzz.com/piao/image/touch/sight/detail.png') 0 -4.45rem no-repeat; // s.qunarzz.com/piao/image/touch/sight/detail.png) 0 -.45rem no-repeat
  margin-right: 0.2rem;
  background-size: 0.8rem 6rem;
}

.item-title {
  line-height: 1.6rem;
  font-size: 0.64rem;
  padding: 0 0.4rem;
}

.item-chilren {
  padding: 0 0.4rem;
}
</style>
